<?php 
require_once BASE_PATH.'application/models/itemdao'.EXT;

class audioDAO extends itemDAO {


	function __construct()
	{
            
	    // Call the Model constructor
	    parent::__construct();
	}
	
        
	function _defaultSQL()
	{
		parent::_defaultSQL(0);
                $this->db->where(array('audio !='=>''));
	}
        
	 
        
        function getIdsRelatedById($id=1,$data=array())
        {
   
            $this->_sql($data);
            $record = $this->_findById($id);
            
            if(count($record) == 0)
                return;
            
            return $record->audios_related; 
        }
        
        function getAudiosById($id=1,$data=array())
        {
            $audios = $this->getIdsRelatedById($id);
            return $this->_findById(explode(",",$audios),array("select"=>"title,introtext,audio"));
        }
           

}
?>